//#define _CRT_SECURE_NO_WANINGS 1
//#pragma warning(disable: 4996)
//#include<stdlib.h>
//#include<math.h>
//#include<stdio.h>
////int treesize(struct TreeNode* root)
////{
////    if (root == NULL)
////    {
////        return 0;
////    }
////    return treesize(root->left) + treesize(root->right) + 1;
////}
////void postorder(struct TreeNode* root, int* i, int* a)
////{
////    if (root == NULL)
////    {
////        return;
////    }
////    postorder(root->left, i, a);
////    postorder(root->right, i, a);
////    a[(*i)++] = root->val;
////}
////int* postorderTraversal(struct TreeNode* root, int* returnSize) {
////    int i = 0;
////    int sz = treesize(root);
////    int* a = (int*)malloc(sizeof(int) * sz);
////    postorder(root, &i, a);
////    *returnSize = i;
////    return a;
////}
///**
// * Definition for a binary tree node.
// * struct TreeNode {
// *     int val;
// *     struct TreeNode *left;
// *     struct TreeNode *right;
// * };
// */
////bool issame(struct TreeNode* root1, struct TreeNode* root2)
////{
////    if (root1 == NULL && root2 == NULL)
////    {
////        return true;
////    }
////    if (root1 == NULL || root2 == NULL)
////    {
////        return false;
////    }
////    if (root1->val != root2->val)
////    {
////        return false;
////    }
////    return issame(root1->left, root2->right) && issame(root1->right, root2->left);
////}
////bool isSymmetric(struct TreeNode* root) {
////    bool judge = issame(root->left, root->right);
////    return judge;
////}
////int treesize(struct TreeNode* root)
////{
////    if (root == NULL)
////    {
////        return 0;
////    }
////    return treesize(root->left) + treesize(root->right) + 1;
////}
////void Inorder(struct TreeNode* root, int* i, int* a)
////{
////    if (root == NULL)
////    {
////        return;
////    }
////    Inorder(root->left, i, a);
////    a[(*i)++] = root->val;
////    Inorder(root->right, i, a);
////
////}
////int* inorderTraversal(struct TreeNode* root, int* returnSize) {
////    int i = 0;
////    int sz = treesize(root);
////    int* a = (int*)malloc(sizeof(int) * sz);
////    Inorder(root, &i, a);
////    *returnSize = i;
////    return a;
////}
//typedef struct treenode
//{
//    struct treenode* left;
//    struct treenode* right;
//    int val;
//}treenode;
//int deepjudge(treenode* root1)
//{
//    if (root1 == NULL)
//    {
//        return 0;
//    }
//    return fmax(deepjudge(root1->left), deepjudge(root1->right)) + 1;
//}
//bool balance(treenode* root1, treenode* root2)
//{
//    if (root1 == NULL && root2 == NULL)
//    {
//        return true;
//    }
//    if (root1 == NULL || root2 == NULL)
//    {
//        if (root2 == NULL)
//        {
//            if (deepjudge(root1) > 2)
//            {
//                return false;
//            }
//            return true;
//        }
//        if (root1 == NULL)
//        {
//            if (deepjudge(root2) > 2)
//            {
//                return false;
//            }
//            return true;
//        }
//    }
//    return balance(root1->left, root2->left) && balance(root1->right, root2->right);
//}
//bool isBalanced( treenode* root) {
//    if (root == NULL)
//    {
//        return true;
//    }
//    bool judge = balance(root->left, root->right);
//    return judge;
//}
//treenode* createnode(int x)
//{
//    treenode* newnode = (treenode*)malloc(sizeof(treenode));
//    newnode->val = x;
//    newnode->left = NULL;
//    newnode->right = NULL;
//    return newnode;
//}
//treenode* createtree()
//{
//    treenode* node1 = createnode(1);
//    treenode* node2 = createnode(2);
//    treenode* node3 = createnode(2);
//    treenode* node4 = createnode(3);
//    treenode* node5 = createnode(3);
//    treenode* node6 = createnode(4);
//    treenode* node7 = createnode(4);
//    node1->left = node2; node1->right = node3;
//    node2->left = node4; node2->right = node5;
//    node4->left = node6; node4->right = node7;
//    return node1;
//}
//int main()
//{
//
//    treenode* root = createtree();
//    printf("%d ", isBalanced(root));
//    return 0;
//    int deepth(struct TreeNode* root)
//    {
//        if (root == NULL)
//        {
//            return 0;
//        }
//        return fmax(deepth(root->left), deepth(root->right)) + 1;
//    }
//    bool isBalanced(struct TreeNode* root) {
//        if (root == NULL)
//        {
//            return true;
//        }
//        int h1 = deepth(root->left);
//        int h2 = deepth(root->right);
//        return abs(h1 - h2) <= 1 && isBalanced(root->left) && isBalanced(root->right);
//    }
//}
struct TreeNode* mergeTrees(struct TreeNode* root1, struct TreeNode* root2) {
if (root1 = NULL)
{
    return root2;
}
if (root2 == NULL)
{
    return root1;
}
struct TreeNode* merge = (struct TreeNode*)malloc(sizeof(struct TreeNode));
merge->val = root1->val + root2->val;
merge->left = mergeTrees(root1->left, root2->left);
merge->right = mergeTrees(root1->right, root2->right);
return merge;
}